#ifndef ICOMPONENT_H
#define ICOMPONENT_H "IComponent.h"

#include "Utilities.h"
#include <string>

namespace ZeEngine
{
	class IComponent
	{
		friend class Entity;
		friend class EntityManager;
		friend class IComponentSystem;

	public:
		IComponent(const std::string& name, s64& type, s64& index);
		virtual ~IComponent();

		virtual void SetActive(bool fActive) {}
		virtual void Reset() {}

		const Entity* GetParent() const { return m_pParent; }

	private:
		static s64 GetAndCreateComponentType(const std::string& name);
		static s64 GetComponentType(const std::map<std::string, s64>& map, const std::string& name);

		void CreateType(const std::string& name);
		s64 GetNextType();
		s64 GetNextIndex();
		virtual s64 GetType() = 0;
		virtual s64 GetIndex() = 0;

		const std::string& GetName() { m_name; }

	private:
		static s64								  m_currentType;
		static s64							      m_currentIndex;
		static std::map<std::string, s64>         m_componentTypes;
		static std::map<std::string, s64>	      m_componentIndexes;

		s64										  m_type;
		s64										  m_index;
		std::string								  m_name;
		Entity*									  m_pParent;
	};
}

#endif

#ifdef ICOMPONENT_I
#undef ICOMPONENT_I

public:

	friend class ZeEngine::Entity;
	friend class ZeEngine::EntityManager;

	virtual s64 GetType(){ return m_type; }
	virtual s64 GetIndex() { return m_index; }

private:
	static s64		m_type;
	static s64		m_index;

#endif